import { sortBy } from 'lodash'
/**
 *
 * @param {object} obj 需要转换为数组的对象
 * @return 转换为的数组结构
 */
export const objToArr = obj => {
  if (Array.isArray(obj)) return []
  let arr = []
  for (let item in obj) {
    arr.push({
      key: item,
      value: obj[item],
    })
  }
  const newArr = sortBy(arr, v => {
    return v.key
  })
  return newArr
}
